package com.crm.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the OFFER database table.
 * 
 */
@Entity
@NamedQuery(name="Offer.findAll", query="SELECT o FROM Offer o")
public class Offer implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue = 1, allocationSize = 1, name="OFFER_OFID_GENERATOR", sequenceName="SEQ1")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="OFFER_OFID_GENERATOR")
	@Column(name="OF_ID")
	private Long ofId;

	@Column(name="ALL_OFFER")
	private BigDecimal allOffer;

	@Column(name="CHANCE_ID")
	private BigDecimal chanceId;

	@Column(name="CHECK_STATE")
	private String checkState;

	@Column(name="CLIENT_ID")
	private BigDecimal clientId;

	@Column(name="CONTACT_ID")
	private BigDecimal contactId;

	@Temporal(TemporalType.DATE)
	@JSONField(format="yyyy-MM-dd")
	@Column(name="\"date\"")
	private Date date;

	@Column(name="OF_NO")
	private String ofNo;

	@Column(name="OF_TYPE")
	private String ofType;

	@Column(name="OFFER_IS_DEL")
	private String offerIsDel;

	private String theme;

	@Column(name="USER_ID")
	private BigDecimal userId;

	//bi-directional many-to-one association to OfferDetail
	@OneToMany(mappedBy="offer")
	@JSONField(serialize = false)
	private List<OfferDetail> offerDetails;

	public Offer() {
	}

	public Long getOfId() {
		return this.ofId;
	}

	public void setOfId(Long ofId) {
		this.ofId = ofId;
	}

	public BigDecimal getAllOffer() {
		return this.allOffer;
	}

	public void setAllOffer(BigDecimal allOffer) {
		this.allOffer = allOffer;
	}

	public BigDecimal getChanceId() {
		return this.chanceId;
	}

	public void setChanceId(BigDecimal chanceId) {
		this.chanceId = chanceId;
	}

	public String getCheckState() {
		return this.checkState;
	}

	public void setCheckState(String checkState) {
		this.checkState = checkState;
	}

	public BigDecimal getClientId() {
		return this.clientId;
	}

	public void setClientId(BigDecimal clientId) {
		this.clientId = clientId;
	}

	public BigDecimal getContactId() {
		return this.contactId;
	}

	public void setContactId(BigDecimal contactId) {
		this.contactId = contactId;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getOfNo() {
		return this.ofNo;
	}

	public void setOfNo(String ofNo) {
		this.ofNo = ofNo;
	}

	public String getOfType() {
		return this.ofType;
	}

	public void setOfType(String ofType) {
		this.ofType = ofType;
	}

	public String getOfferIsDel() {
		return this.offerIsDel;
	}

	public void setOfferIsDel(String offerIsDel) {
		this.offerIsDel = offerIsDel;
	}

	public String getTheme() {
		return this.theme;
	}

	public void setTheme(String theme) {
		this.theme = theme;
	}

	public BigDecimal getUserId() {
		return this.userId;
	}

	public void setUserId(BigDecimal userId) {
		this.userId = userId;
	}

	public List<OfferDetail> getOfferDetails() {
		return this.offerDetails;
	}

	public void setOfferDetails(List<OfferDetail> offerDetails) {
		this.offerDetails = offerDetails;
	}

	public OfferDetail addOfferDetail(OfferDetail offerDetail) {
		getOfferDetails().add(offerDetail);
		offerDetail.setOffer(this);

		return offerDetail;
	}

	public OfferDetail removeOfferDetail(OfferDetail offerDetail) {
		getOfferDetails().remove(offerDetail);
		offerDetail.setOffer(null);

		return offerDetail;
	}

}